
#ifndef _DATA_TYPEDEF_H_
#define _DATA_TYPEDEF_H_

#define DBTYPE_OPENGAUSS 1
#define DBTYPE_POSTGRES  2

#define DF_MAX_NAME_LEN 64
#define DF_MAX_PORT_LEN 11
#define DF_MAX_PATH_LEN 1024

#define DF_CHAROID			18
#define DF_INT2OID         21
#define DF_INT8OID			20
#define DF_INT4OID			23
#define DF_TEXTOID			25
#define DF_VARCHAROID		1043
#define DF_BPCHAROID		1042
#define DF_FLOAT4OID        700
#define DF_FLOAT8OID        701
#define DF_TIMESTAMPOID     1114
#define DF_TIMESTAMPTZOID	1184
#define DF_DATEOID			1082
#define DF_TIMEOID			1083
#define DF_BOOLOID			16

#define PAGE_SIZE (1024 * 8)

#define IS_UNIQUE_TYPID(typid) (typid == DF_INT8OID || typid == DF_INT4OID)

typedef unsigned char uint8;
typedef unsigned int uint32;
typedef unsigned short uint16;
typedef unsigned long long int uint64;
typedef long long int int64;
typedef short int16;
typedef uint8 bool;
typedef uint8 bits8;
typedef uint16 OffsetNumber;
typedef signed char int8;

#define true 1
#define false 0

/* Data Flood 数据结构区域 */
typedef struct UserArgument {
    char *db_user;
    char *db_port;
    char *db_name;
    char *db_password;
    char *rel_name;
    char *unique_column;
    int  unique_no;
    char *config_path;
    uint32  thread_num;
    uint32  files;
    bool fastmode;
    bool force;
    bool verbose;

    int db_type;
}UserArgument;


/* 下面是数据库数据结构代码 */
typedef struct AttributeMap {
    uint32 typid;
    int atts;//放这里并不是很合适,anyway.
    char typname[DF_MAX_NAME_LEN];
    char attname[DF_MAX_NAME_LEN];
    bool isunique;
    int64 unique_num;
    int atttypmod;
}AttributeMap;

/* 外部变量区域 */
extern UserArgument user_arg;

#endif